<div class="r0 p10 pt0 col-xs-12" ng-controller="backInterfaceDetailCtrl">
	<div class="col-xs-12 p0" id="interFaceDetail">
		<form ng-submit="submitForm('user/interface/addOrUpdate.do')">
			<table class="table table-bordered">
				<tr>
					<td class="tc w80">接口名称</td>
					<td class="tc w400">
						<input class="form-control" type="text" required maxlength="50" 
						ng-model="model.interfaceName" placeholder="示例：获取订单列表接口">
					</td>
					<td class="tc">
					模块名<br/>
					* 点击选择模块
					</td>
					<td>
						<input class="form-control cursor" type="text"  id="moduleName" required readonly ng-model="model.moduleName"
							ng-click="loadPickByName('iwidth=220|iheight=250|tagName=moduleName|tag=moduleId|code=MODULES|def='+model.moduleId+'|params=&key='+model.projectId,$event)">
				
					</td>
				</tr>
				<tr>
					<td class="tc">URL</td>
					<td class="tc" colspan="3">
					    <div ng-class="{true: 'input-group w', false: 'w'}[model.moduleUrl!='']">
					      <div class="input-group-addon" ng-bind="model.moduleUrl" ng-if="model.moduleUrl"></div>
					      <input type="text" class="form-control" ng-model="model.url" required maxlength="200"
						placeholder="示例：http://api.crap.cn/CustomerOrder/{id}">
					    </div>
					</td>
				</tr>
				<tr>
					<td class="tc w80">请求方式</td>
					<td class="tc">
						<input class="form-control cursor" type="text"  id="method" placeholder="请点击输入框选择" required ng-model="model.method"
							ng-focus="loadPickByName('iwidth=220|radio=false|iheight=250|tag=method|code=REQUESTMETHOD|def='+model.method,$event)">
					</td>
					<td class="tc">状态</td>
					<td>
						<input class="form-control" type="text" id="status"
							ng-focus="loadPick($event,220,220,'true','status','INTERFACESTATUS','',model.status);"
								ng-model="model.status" required placeholder="请点击输入框选择">
					</td>
				</tr>
				<tr>
					<td class="tc w80">版本号</td>
					<td class="tc"><input class="form-control" type="text"
						ng-model="model.version" required></td>
					<td class="tc">排序</td>
					<td class="tc">
					<input class="form-control" min="0" max="10000" required type="number" ng-model="model.sequence"></td>
				</tr>
				<tr>
					<td class="tc w80">监控类型</td>
					<td class="tc">
					<input  class="form-control" type="text" ng-model="model.monitorTypeName" id="monitorTypeName" required placeholder="点击选择"
					ng-focus="loadPickByName('iwidth=220|iheight=320|tagName=monitorTypeName|tag=monitorType|code=MONITORTYPE|def='+model.monitorType,$event)">
					</td>
					<td class="tc"></td>
					<td class="tc"></td>
				</tr>
				<tr ng-if="model.monitorType>1">
					<td class="tc">监控内容<br/>符合该条件则会发送邮件告警</td>
					<td class="tc" colspan="3">
						<textarea class="form-control no-resize" ng-model="model.monitorText" rows="8"
							placeholder="请输入监控比较的内容" max="250">
						</textarea>
					</td>
				</tr>
				<tr ng-if="model.monitorType>1">
					<td class="tc">告警发送邮箱<br/>多个邮箱用;分割</td>
					<td class="tc" colspan="3">
						<textarea class="form-control no-resize" ng-model="model.monitorEmails" rows="4"
							placeholder="告警邮箱" max="250">
						</textarea>
					</td>
				</tr>
				<tr>
					<td class="tc">请求头</td>
					<td class="tc" colspan="3">
							<div id="eheader" class="none">
								<table class="table table-hover" id="editHeaderTable">
									<thead>
										<tr class="btn-main">
											<th>名称</th>
											<th>是否必须</th>
											<th>类型</th>
											<th>默认值</th>
											<th>备注</th>
											<th class="w50">操作</th>
										</tr>
									</thead>
									<tbody>
										<tr ng-repeat="item in model.headers track by $index">
											<td><input class="form-control" type="text" name="name" value="{{item.name}}" placeholder="参数名：必填"></td>
											<td class="w100">
												<select name="necessary" class="form-control">
													<option value="true" ng-selected="item.necessary=='true'">true</option>
													<option value="false" ng-selected="item.necessary=='false'">false</option>
												</select>
											</td>
											<td class="w100">
												<select name="type" class="form-control">
													<option value="string" ng-selected="item.type=='string'">string</option>
													<option value="int" ng-selected="item.type=='int'">int</option>
													<option value="float" ng-selected="item.type=='float'">float</option>
													<option value="long"  ng-selected="item.type=='long'">long</option>
													<option value="byte"  ng-selected="item.type=='byte'">byte</option>
													<option value="double"  ng-selected="item.type=='double'">double</option>
													<option value="boolean"  ng-selected="item.type=='boolean'">boolean</option>
													<option value="file"  ng-selected="item.type=='file'">file</option>
												</select>
											</td>
											<td><input class="form-control" type="text" name="def" value="{{item.def}}" placeholder="默认值"></td>
											<td><input class="form-control" type="text" name="remark" value="{{item.remark}}"></td>
											<td class="cursor text-danger"><i class="iconfont" onclick="deleteOneParam(this)">&#xe60e;</i></td>
										</tr>
									</tbody>
								</table>
								<button type="button"
									ng-click="modifyParam('eheader','header',model,'header')"
									class="btn btn-warning fr ml10">提交修改</button>
								<button type="button"
									ng-click="addOneHeard()"
									class="btn btn-success fr ml10">添加</button>
								<button type="button" onclick="changeDisplay('header','eheader')"
									class="btn btn-primary fr">返回</button>
							</div>
							<div class="input-group w" id="header">
								<textarea class="form-control no-resize" ng-model="model.header"
									rows="6" readonly placeholder="请点击“编辑”按钮编辑参数"></textarea>
								<div class="input-group-addon cursor btn-main"
									ng-click="editerParam('eheader','header',model,'editHeaderTable');">
									编辑</div>
							</div>
					</td>
				</tr>
				
				
				<tr>
					<td class="tc">
						参数<br> 
						<input type="button" class="btn btn-default btn-sm w100 mt10" value="Form" onclick="changeDisplay('formParam','customParam')">
						<input type="button" class="btn btn-default btn-sm w100 mt10" value="Custom" onclick="changeDisplay('customParam','formParam')">
					</td>
					<td class="tc" colspan="3">
					
					
						<!-- form表单参数 -->
						<div id="formParam">
							<div id="eparam" class="none">
								<table class="table table-hover" id="editParamTable">
									<thead>
										<tr class="btn-main">
											<th>名称</th>
											<th>是否必须</th>
											<th>位置</th>
											<th>类型</th>
											<th>默认值</th>
											<th>备注</th>
											<th class="w50">操作</th>
										</tr>
									</thead>
									<tbody>
										<tr ng-repeat="item in model.params track by $index">
											<td><input class="form-control" type="text" name="name" value="{{item.name}}" placeholder="参数名：必填"></td>
											<td class="w100">
												<select name="necessary" class="form-control">
													<option value="true" ng-selected="item.necessary=='true'">true</option>
													<option value="false" ng-selected="item.necessary=='false'">false</option>
												</select>
											</td>
											<td class="w100">
												<select name="inUrl" ng-if="item.inUrl && item.inUrl=='false'" class="form-control">
													<option value="false" selected="selected">普通参数</option>
													<option value="true">URL路径</option>
												</select>
												<select name="inUrl" ng-if="!item.inUrl || item.inUrl!='false'" class="form-control">
													<option value="false">普通参数</option>
													<option value="true" selected="selected">URL路径</option>
												</select>
											</td>
											<td class="w100">
												<select name="type" class="form-control">
													<option value="string" ng-selected="item.type=='string'">string</option>
													<option value="int" ng-selected="item.type=='int'">int</option>
													<option value="float" ng-selected="item.type=='float'">float</option>
													<option value="long"  ng-selected="item.type=='long'">long</option>
													<option value="byte"  ng-selected="item.type=='byte'">byte</option>
													<option value="double"  ng-selected="item.type=='double'">double</option>
													<option value="boolean"  ng-selected="item.type=='boolean'">boolean</option>
													<option value="file"  ng-selected="item.type=='file'">file</option>
												</select>
												
											</td>
											<td><input class="form-control" type="text" name="def" value="{{item.def}}" placeholder="默认值"></td>
											<td><input class="form-control" type="text" name="remark" value="{{item.remark}}"></td>
											<td class="cursor text-danger"><i class="iconfont" onclick="deleteOneParam(this)">&#xe60e;</i></td>
										</tr>
									</tbody>
								</table>
								<button type="button"
									ng-click="modifyParam('eparam','param',model,'param')"
									class="btn btn-warning fr ml10">提交修改</button>
								<button type="button"
									ng-click="addOneParam()"
									class="btn btn-success fr ml10">添加</button>
								<button type="button" onclick="changeDisplay('param','eparam')"
									class="btn btn-primary fr">返回</button>
							</div>
							<div class="input-group w" id="param">
								<textarea class="form-control no-resize" ng-model="model.param"
									rows="6" readonly placeholder="请点击“编辑”按钮编辑参数"></textarea>
								<div class="input-group-addon cursor btn-main"
									ng-click="editerParam('eparam','param',model,'editParamTable');">
									编辑</div>
							</div>
						</div>
						<!-- End:form表单参数 -->
						
						
						<!-- 自定义参数 -->
						<div class="input-group w none" id="customParam">
							<textarea class="form-control no-resize" ng-model="model.param" rows="6" placeholder="自定义参数"></textarea>
						</div>
						<!-- End:自定义参数 -->
						
						
					</td>
				</tr>
				<tr>
					<td class="tc">
						返回参数
						<input type="button" class="btn btn-default btn-sm w100 mt10" value="编辑" onclick="changeDisplay('responseEditorDiv','responseImportDiv')">
						<input type="button" class="btn btn-default btn-sm w100 mt10" value="导入" onclick="changeDisplay('responseImportDiv','responseEditorDiv')">
					</td>
					<td class="tc" colspan="3">
						<div class="input-group w none" id="responseImportDiv">
								<textarea class="form-control no-resize" ng-model="model.importJson"
									rows="6" placeholder="请输入需要导出的json数据"></textarea>
								<div class="input-group-addon cursor btn-main"
									ng-click="importResponseParams();">
									导入</div>
						</div>
						<div  id="responseEditorDiv">
							<div id="responseEparam" class="none">
								<table class="table table-hover table-bordered" id="editResponseParamTable">
									<thead>
										<tr class="btn-main">
											<th class="w50"></th>
											<th>名称</th>
											<th class="w100">类型</th>
											<th class="w100">是否必须</th>
											<th class="w200">备注</th>
											<th class="w50">操作</th>
										</tr>
									</thead>
										<tr ng-repeat="item in model.responseParams track by $index">
											<td style="color:red;" class="p5">
												{{item.deep}}
												<input type="hidden" name="deep" value="{{item.deep}}" ng-model="item.deep">
											</td>
											<td class="p5">
												<input class="form-control b0 no-b-s" style="padding-left:{{item.deep*10 + 'px'}}" type="text" name="name" ng-model="item.name" value="{{item.name}}" placeholder="参数名：必填">
											</td>
											<td class="w100 p5">
													<select name="type" class="form-control b0 no-b-s" ng-model="item.type">
														<option value="string" ng-selected="item.type=='string'">string</option>
														<option value="number" ng-selected="item.type=='number'">number</option>
														<option value="boolean" ng-selected="item.type=='boolean'">boolean</option>
														<option value="object"  ng-selected="item.type=='object'">object</option>
														<option value="array[number]"  ng-selected="item.type=='array[number]'">array[number]</option>
														<option value="array[boolean]"  ng-selected="item.type=='array[boolean]'">array[boolean]</option>
														<option value="array[string]"  ng-selected="item.type=='array[string]'">array[string]</option>
														<option value="array[object]"  ng-selected="item.type=='array[object]'">array[object]</option>
														<option value="file"  ng-selected="item.type=='file'">file</option>
													</select>
											</td>
											<td class="p5">
													<select name="necessary" class="form-control b0 no-b-s" ng-model="item.necessary">
														<option value="true" ng-selected="item.necessary=='true'">true</option>
														<option value="false" ng-selected="item.necessary=='false'">false</option>
													</select>
											</td>
											<td class="p5">
												<input class="form-control b0 no-b-s" type="text" name="remark" ng-model="item.remark" value="{{item.remark}}" placeholder="备注">
											</td>
											<td class="cursor text-danger p5">
												<i class="iconfont" ng-click="deleteOneResponseParam($index,item.deep)">&#xe60e;</i>
												<i class="iconfont" ng-click="addOneResponseParamByParent(item.name,item.deep,$index)" ng-if="item.type=='object' || item.type=='array[object]'">&#xe604;</i>
											</td>
										</tr>
									<tbody>
									</tbody>
								</table>
								<button type="button"
									ng-click="modifyParam('responseEparam','responseParam',model,'responseParam')"
									class="btn btn-warning fr ml10">提交修改</button>
								<button type="button"
									ng-click="addOneResponseParam()"
									class="btn btn-success fr ml10">添加</button>
								<button type="button"
									onclick="changeDisplay('responseParam','responseEparam')"
									class="btn btn-primary fr">返回</button>
							</div>
							<div class="input-group w" id="responseParam">
								<textarea class="form-control no-resize"
									ng-model="model.responseParam" rows="6" readonly
									placeholder="请点击“编辑”按钮编辑返回参数"></textarea>
								<div class="input-group-addon cursor btn-main"
									ng-click="editerParam('responseEparam','responseParam',model,'editResponseParamTable');">
									编辑</div>
							</div>
						</div>

					</td>
				</tr>
				<tr>
					<td class="tc">接口说明</td>
					<td class="tc h400" colspan="3">
						<div text-angular="text-angular" class="tl" ng-model="model.remark"></div>
					</td>
				</tr>
				<tr>
					<td class="tc">正确返回示例<br> 
					<input type="button" class="btn btn-default btn-sm w100 mt10" value="格式化数据"
						ng-click="jsonformat('trueExam',true)">
					</td>
					<td class="tc"><textarea class="form-control no-resize" ng-model="model.trueExam" rows="10"
							placeholder='请用标准json结构
示例：	{
			"success": 1,			
			"data": {
				"num": 15 		
			},
			"error": 
			{
				"message":null, 	
				"code":null, 		
				"data":null
			}
		}'></textarea>
					</td>
					<td class="tc">错误返回示例<br> <input type="button"
						class="btn btn-default btn-sm" value="格式化数据"
						ng-click="jsonformat('falseExam',true)"></td>
					<td class="tc"><textarea class="form-control no-resize" ng-model="model.falseExam" rows="10"
							placeholder='请用标准json结构
示例：	{
			"success": 0,
			"error": {
				"code": 错误码,
				"data": {},
				"message": " error message"
			}
		}'></textarea></td>
				</tr>
				<tr>
					<td class="tc">请求示例<br> 
						<input type="button" class="btn btn-default btn-sm w100 mt10" value="自动生成" ng-click="getRequestExam()">
					</td>
					<td class="tc"><textarea class="form-control no-resize"
							ng-model="model.requestExam" rows="5"
							placeholder='示例：
请求地址：
	http://api.biyao.com
请求参数：
	name=xxx
请求头：
	uid=xxx'></textarea>
					</td>
					<td class="tc">错误列表</td>
					<td class="tc">
						<div class="input-group w">
							<textarea class="form-control no-resize" id="errorList"
								placeholder="请点击“选择”按钮选择错误码
键盘输入可快速定位错误码
退格键可删除输入"
								ng-model="model.errorList" rows="5" readonly></textarea>
							<div class="input-group-addon cursor btn-main"
								ng-click="loadPick($event,300,400,'false','errorList','ERRORCODE','',model.errorList,'&key='+model.projectId,0);">
								选择</div>
						</div>
					</td>
				</tr>

			</table>
			<button type="submit" class="btn btn-success fr">提交</button>
		</form>
	</div>
	<div class="col-xs-12 p0 mt10 none" id="copyInterFace">
		<form ng-submit="submitForm('user/interface/copy.do')">
			<input class="form-control mb10" type="text"
							ng-model="model.interfaceName" placeholder="示例：获取订单列表接口" required>
			<input class="form-control mb10" type="text" ng-model="model.url" required
							placeholder="示例：http://api.crap.cn/CustomerOrder/GetMyOrderList">
			<input  class="form-control mb10" id="moduleName" type="text" ng-model="model.moduleName" required placeholder="点击输入框选择模块"
					ng-focus="loadPickByName('iwidth=220|iheight=320|tagName=moduleName|tag=moduleId|code=MYMODULE|def='+model.moduleId,$event)">
			<button type="submit" class="btn btn-adorn fr">拷贝</button>
		</form>
	</div>
	
</div>
<div class="cb"></div>

